<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<script type="text/javascript">
			// 1.求1+2+...100=和;
			var sum = 0;
			for (var a = 1; a <= 100; a++) {
				sum += a;
			}
			console.log(sum);
			
			//2.求1-100之间,既是3的倍数又是5的倍数;
			for (var m = 1; m <= 100; m++) {
				if (m % 3 == 0 && m % 5 ==0) {
					console.log(m);
				}
			}
			
			//3.求和；
			var sum1 = 0;
			for ( var i = 0 ; i <= 5; i++) {
				sum1 = i + (5 - i);
		     	console.log(i,"+",(5-i), "=" , i+(5-i));
			}
			
//			for(var j = 0 ;j <=5 ; j++){
//		     console.log(j,"+",(5-j), "=" ,j+(5-j));
//		    }
			
			//4.求2,-4,6,-8....n,求第n个值是多少?-->
			var n = 6 ;
			for (v = 1;  v <= n; v++) {
				if (n % 2 == 0) {
					
					console.log("第" , n, "个值：",-2*n);
				} else{
					console.log("第" , n, "个值：",2*n);
				}
			}
		</script>
		
	</body>
</html>
